package com.t194.controller;

import com.t194.entity.User;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class IndexController {
    @GetMapping("/index")
    public String index() {
        Subject subject = SecurityUtils.getSubject();
        Session session = subject.getSession();
        User loginUser = (User) subject.getPrincipal();
        session.setAttribute("loginUser", loginUser);
        return "redirect:/index";
    }
}
